{include file="common/header" /}
<link rel="stylesheet" href="__LAYUIMINI__/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
<style>
    body {
        background-color: #ffffff;
    }
    .img-item {
        position: relative;
        width: 96px;
        height: 96px;
        border-radius: 6px;
        margin-bottom: 10px;
        margin-right: 10px;
    }
    .img-item img {
        border-radius: 6px;
        width: 100%;
        height: 100%;
    }
    .img-item i {
        font-size: 20px;
        position: absolute;
        top: -10px;
        right: -10px;
    }

</style>
<body>
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
  <legend>{$title}修改</legend>
</fieldset>
<div class="layui-form layuimini-form">
    

    <div class="layui-form-item">
        <label class="layui-form-label required">站点名称</label>
        <div class="layui-input-inline width-400">
            <input type="text" class="layui-input" name="name"  value="{$info.name}" autocomplete="off" placeholder="请输入站点名称">
        </div>
        <div class="layui-form-mid layui-word-aux">站点切换名称，例如：英文站</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">站点标识</label>
        <div class="layui-input-inline width-400">
            <input type="text" class="layui-input" name="key"  value="{$info.key}" autocomplete="off" placeholder="请输入站点标识">
        </div>
        <div class="layui-form-mid layui-word-aux">站点切换参数，例如：en_us</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label required">站点标题</label>
        <div class="layui-input-inline width-400">
            <input type="text" class="layui-input" name="webname"  value="{$info.webname}" autocomplete="off" placeholder="请输入站点标题">
        </div>
        <div class="layui-form-mid layui-word-aux">用于META头部 title 显示</div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label ">排序</label>
        <div class="layui-input-block col-sm-400">
            <input type="text" class="layui-input" name="orderid"  value="{$info.orderid}" autocomplete="off" placeholder="请输入排序">
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <input type="hidden" name="act" value="edit">
            <input type="hidden" name="site_id" value="{$site_id}">
            <button class="layui-btn" lay-submit lay-filter="saveBtn">确认保存</button>

            <button class="layui-btn layui-btn-primary" onclick="javascript:history.go(-1)" >返回</button>
        </div>
    </div>
</div>


<script>

    layui.use(['form','iconPickerFa','upload','laydate'], function () {
        var form = layui.form,
            iconPickerFa = layui.iconPickerFa,
            layer = layui.layer,
            upload = layui.upload,
            laydate = layui.laydate,
            $ = layui.$;

        //监听提交
        form.on('submit(saveBtn)', function (data) {
            var index = layer.load(1, {
                shade: [0.3,'#000'] //0.1透明度的白色背景
            });
            var data = data.field;
            $.ajax({
                url:"{:url(CONTROLLER_NAME.'/edit')}",
                data:data,
                type:'post',
                dataType:'json',
                success:function(res){
                    console.log(res)
                    // return false
                    if(res.errcode != 1){
                        layer.msg(res.message,{icon: 2,time: 2000},function(){
                            layer.close(index);
                        })
                    }else{
                        layer.msg(res.message,{icon: 1,time: 1000},function () {
                            //window.location.href = "{:url(CONTROLLER_NAME.'/list')}";
                            parent.location.reload();
                        })
                    }
                    layer.close(index);
                },
                error : function(XMLHttpRequest, textStatus, errorThrown) {
                    layer.msg('网络失败，请刷新页面后重试!',{icon: 2,time: 2000})
                }
            });

            return false;
        });

    });
</script>
</body>
</html>